<template>
  <div class="suo" >
    <div class="suo-one">搜索结果</div>
    <div class="suo-one-q">
      找到<span class="suo-one-qq"> {{ total }}</span
      >家企业
    </div>
    <zujian5 v-for="(item, index) in shuju" :key="index" :info="item">
    </zujian5>
  </div>
</template>
<script>
import zujian5 from "../components/djl/zujian5.vue";
import axios from "axios";
import { desEncrypt, desDecrypt } from "../../../des.js";

export default {
  name: "",
  /*1. Vue扩展 */
  extends: "", // extends和mixins都扩展逻辑，需要重点放前面
  mixins: [],
  components: { zujian5 },
  /* 2. Vue数据 */
  props: {},
  model: { prop: "", event: "" }, // model 会使用到 props
  data() {
    return {
      shuju: [],
      total: "",
    };
  },
  computed: {},
  watch: {}, // watch 监控的是 props 和 data，有必要时监控computed
  /* 3. Vue资源 */
  filters: {},
  directives: {},
  /* 4. Vue生命周期 */
  created() {
    console.log(this.$route.query.name);
    // this.getList();
    this.test();
  },
  mounted() {},
  destroy() {},
  /* 5. Vue方法 */
  methods: {
    getList() {
      const headers = {
        token: "cxgc123456",
      };

      const url = "/map/fullAmountCorp";
      const params = {
        pageBO: {
          pageSize: 20,
          pageNum: 1,
        },
        searchParam: this.$route.query.name,
      };

      const newParams = {
        data: desEncrypt(
          JSON.stringify(params),
          "98fbffd1064a4355b8abaacb6fa96f94"
        ),
      };

      axios
        .post(url, newParams, { headers: headers })
        .then((response) => {
          const resContent = JSON.parse(
            desDecrypt(response.data.data, "98fbffd1064a4355b8abaacb6fa96f94")
          );
          console.log(resContent, "请求的结果"); // 处理响应数据
          this.shuju = resContent.data.list;
          this.total = resContent.data.total;
        })
        .error((error) => {
          console.error(error);
        });
    },
    // 练习同步和异步
    test() {
      // 异步函数 延迟一段时间，执行代码
      setTimeout(() => {
        console.log(5);
        console.log(6);
        console.log(7);
      }, 0);
      let a = 1;
      console.log(a);
      let b = 2;
      console.log(b);
      let c = 3;
      console.log(c);
    },
  },
};
</script>
<style scoped lang="scss">
.suo {
  .suo-one {
    font-size: 17px;
    font-family: Alibaba PuHuiTi;
    font-weight: 400;
    color: #000000;
    text-align: center;
    margin-top: 59px;
  }

  .suo-one-q {
    height: 27px;
    background: #f3f3f3;
    line-height: 27px;
    margin-left: 9px;
    font-size: 13px;
    font-family: Alibaba PuHuiTi;
    font-weight: 400;
  }

  .suo-one-qq {
    font-size: 13px;
    font-family: Alibaba PuHuiTi;
    font-weight: 400;

    color: #dc0511;
  }
}
</style>
